package com.zx.onlineeducation.common.servicebase.exception;

import com.zx.onlineeducation.common.util.ResultCodeEnum;
import lombok.Data;

/**
 * 自定义在线教育项目的异常
 * <p>用来捕获针对项目或业务的异常</p>
 *
 * @author 郑雪
 * @since 2022-01-08
 */
@Data
public class OnlineEducationException extends RuntimeException {

    private Integer code;

    public OnlineEducationException(Integer code, String message) {
        super(message);
        this.code = code;
    }

    public OnlineEducationException(ResultCodeEnum resultCodeEnum) {
        super(resultCodeEnum.getMessage());
        this.code = resultCodeEnum.getCode();
    }
}
